const path = require('path')
const webpack = require('webpack')
const rm = require('rimraf')
const chalk = require('chalk')

const webpackBaseConfig = require('./webpack.config.base')

const distPath = path.resolve(__dirname, './dist/')

rm(distPath, err => {
  if (err) {
    throw err
  }
  console.log(chalk.yellow('Clean Dist folder success'))

  webpack(webpackBaseConfig, (err, stats) => {
    if (err) {
      throw err
    }
  })
})
